
// 进度条的数字X坐标计算公式
// barWidth*(0.8*p-0.06)
$(document).ready(function () {

    //第一部分的环形图
    // let c1=0.2,c2=0.6,c3=0.7,c4=1;
    // $('#circle-SelfDevelop').attr('stroke-dasharray',100*Math.PI*c1+" "+100*Math.PI);
    // $('#circle-OtherDevelop').attr('stroke-dasharray',100*Math.PI*c2+" "+100*Math.PI);
    // $('#circle-ConcentratedDevelop').attr('stroke-dasharray',100*Math.PI*c3+" "+100*Math.PI);
    // $('#circle-CooperateDevelop').attr('stroke-dasharray',100*Math.PI*c4+" "+100*Math.PI);
    // var fare1=3999;
    // $('#cost-SelfDevelop').html("￥"+fare1);

    // var p3=.9;
    // $('#circle-OtherDevelop').attr('stroke-dasharray',100*Math.PI*p3+" "+100*Math.PI);
    // var fare3=999;
    // $('#cost-OtherDevelop').html("￥"+fare3);

    //第二部分的进度条 左边部分
    // var resultNum=30;

    // var num=5; //传入数量，假设总成果为10
    // var p2=num/resultNum;
    // $('#react-DefensePatent').attr('width',100*p2+'%');
    // var barLeftWidth=$('.tipResultCategory .rowDetailItems').width()/12*7; //数字12=5+7为栅栏分布比

    // console.log(barWidth);
    // $('#number-react-DefensePatent').attr('x',barLeftWidth*(0.8*p2-0.06));
    // $('#number-react-DefensePatent').html(num);
    // console.log(barWidth*p);

    //第二部分的进度条 右边部分
    // var barRightWidth=$('.tipProjectStatus .rowDetailItems').width()/12*8;
    // var numSumProject=10; //假设项目总数为10
    // var numFinishedProject=3;
    // var numEstablishedProject=numSumProject-numFinishedProject;
    // var p31=numEstablishedProject/numSumProject;
    // var p32=1-p31;
    // $('#react-EstablishedProject').attr('width',100*p31+'%');
    // $('#number-react-EstablishedProject').attr('x',barRightWidth*(0.8*p31-0.06));
    // $('#number-react-EstablishedProject').html(numEstablishedProject);

    // $('#react-FinishedProject').attr('width',100*p32+'%');
    // $('#number-react-FinishedProject').attr('x',barRightWidth*(0.8*p32-0.06));
    // $('#number-react-FinishedProject').html(numFinishedProject);
// 
    // 饼状图部分
    var unfinishedNum=100;
    // numFinishedProject
    // numEstablishedProject
    var myChart=echarts.init(document.getElementById('projectPIE'));
    let status = Number($('#status').attr('data-value'))
    let approve = Number($('#approve').attr('data-value'))

    var option = {
        legend: {
            orient: 'vertical',
            right: 50,
            top: 130,
            data: ['已立项','已完成']
        },
        series : [
            {
                type: 'pie',
                radius : '60%',
                animation: false,
                label:false,
                center: ['40%', '50%'],
                data:[
                    {value:approve, name:'已立项'},
                    {value:status, name:'已完成'}
                ],
            }
        ],

        color:[new echarts.graphic.LinearGradient(0,1,0,0,[{
            offset:0,
            color:'rgb(21,228,118)'
        },{
            offset:1,
            color:'rgb(148,236,190)'
        }]),new echarts.graphic.LinearGradient(0,1,0,0,[{
            offset:0,
            color:'rgb(21,119,228)'
        },{
            offset:1,
            color:'rgb(64,208,232)'
        }])]
    };

    myChart.setOption(option);

    //任务中心
    //以组织框架为例
    //假设flag=1时，某页面已完善填写
    var flag=1;
    if(flag===1){
        $('.departmentManage .statusShow').addClass('active');
    }
});
